<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta content="text/html;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta http-equiv ="Pragma" content = "no-cache"/>
	<meta http-equiv="Cache-Control" content="no cache" />
	<meta http-equiv="Expires" content="0" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="format-detection" content="telephone=no"/>
	<script src="https://cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
	<link href="https://cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" type="text/css" href="../../css/fs.css" media="all"/>
	<script type="text/javascript" src="../../plugins/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="../../plugins/home/common.js"></script>
	<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
	<script type="text/javascript" src="../../plugins/layui/layui.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/fsDict.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/fs.js"></script>
	<script type="text/javascript" src="../../plugins/frame/js/frame.js"></script>
	<script type="text/javascript" src="../../scripts/home/yunhetong.js"></script>
</head>
<body>
<div >
	<div class="layui-fluid">
		<div class="layui-row layui-col-space1">
			<div class="layui-col-md12">
				<div class="layui-form-query">
					<form class="layui-form" id="query_form">
						<input type="hidden" name="contractId"/>
					</form>
				</div>
			</div>
			<div class="layui-col-md12">
				<div class="layui-row grid-demo">
					<div class="layui-col-md12">

					</div>
					<div class="layui-col-md12">
						<table id="fsDatagrid" lay-filter="fsDatagrid" class="fsDatagrid" isLoad="1" url="/constractCancel/findAllListPage.shtml" isPage="1" sortType="1" defaultForm="query_form" height="full-135"></table>
						<div class="fsDatagridCols">
							<p field="cancelContractNum" title="作废协议编号" width="160" sort="true"/>
							<p field="contTyp" title="作废协议状态" width="160" sort="true"/>
							<p field="createDate" title="创建时间" width="160" sort="true"/>
							<p field="operatorName" title="创建人" width="160" sort="true"/>
							<p fixed="right" align="center" width="160" toolbar="#barDemo" title="操作"/>
						</div>
						<script type="text/html" id="barDemo">
							<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="lookContract"  inputs="id:"  target="_blank">查看</a>
							<a  id="lookContractHref" target="_blank" download="" style="display: none">
								<p>跳转</p>
							</a>
						</script>
						<script type="text/html" id="column2Tpl">
							{{# if(d.userType=='PERSONAL'){}}
							<span style="color: #5FB878">个人用户</span>
							{{#} else if(d.userType=='INSTITUTION'){}}
							<span style="color: #5FB878"> 企业</span>
							{{#} else if(d.userType=='INVESTMENT_MANAGER'){}}
							<span style="color: #5FB878"> 客户经理</span>
							{{#} else if(d.userType=='FAMILY'){}}
							<span style="color: #5FB878"> 家庭</span>
							{{#} else {}}
							<span style="color: #5FB878"> </span>
							{{#}}}
						</script>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
    var domain=getRootPath();
    layui.fsButton.lookContract = function(elem,data,datagrid){
        download(data.cancelContractId);
    }
    function download(cancelContractId){
        $.ajax({
            url: domain+"/api/v2/yunhetong/download/contract", //请求的url地址
            dataType: "json", //返回格式为json
            async: true, //请求是否异步，默认为异步，这也是ajax重要特性
            data: {
                "idType": "0",
                "idContent":cancelContractId
            }, //参数值
            type: "post", //请求方式
            beforeSend: function() {
                //请求前的处理
            },
            success: function(req) {
                //console.log("查看返回结果==========================="+JSON.stringify(req));
                //请求成功时处理
				$("#lookContractHref").attr('href',req.data);
                $("#lookContractHref>p").trigger('click') ;
				//window.location.href=req.data;
            },
            complete: function() {
                //请求完成的处理
            },
            error: function() {
                //请求出错处理
            }
        });
    }
</script>
</body>
</html>

